﻿@model IEnumerable<BskLeague.Models.Advert>

@{
    ViewBag.Title = "Ogłoszenia";
}

<h2>Ogłoszenia</h2>

<p>
    <a href='@Url.Action("New")'>
        <img src="../../Content/images/new-icon.png" alt="nowy" />
    </a>
</p>

<table width="100%">

    <tr>
        <th>Tytuł ogłoszenia</th>
        <th>E-Mail</th>
        <th>Data</th>
        <th>&nbsp;</th>
    </tr>
    @foreach (var advert in Model)
    {
        <tr>
            <td>@Html.ActionLink(@advert.advertTitle, "Details", new { id = @advert.advertId })</td>
            <td>
                <a href="mailto:@advert.advertMail">@advert.advertMail</a>
            </td>
            <td>@advert.advertDate.ToString()</td>
            <td>
                @if (User.IsInRole("Admin"))
                {
                    <a href="javascript:if(confirm('Na pewno usunąć?')){window.location='/Advert/AdminRemove/@advert.advertId'}">
                        <img src='../../Content/images/delete-icon.png' title='usuń' alt='usuń' />
                    </a>
                }
            </td>
        </tr>
    }

</table>